<template>
	<view>


		<view class="ccc" style="width: 100%;height: 50rpx;text-align: center;">
			<text>密码只能是 6 位数字</text>
		</view>

		<van-form>
			<van-field v-model="password" :type="seen ? type_text : type_password" name="密码" label="密码" placeholder="密码" :rules="[{ required: true, message: '不能为空', trigger: 'blur' },
		                   {min: 6, message: '至少6位', trigger: 'blur'},
		                   {type: 'number', message: '请输入数字', trigger: 'blur'}]" />
						  <view class="eye" v-show='seen' @click="changeSeen">
						         <image src="../../static/tabs/eye.png" />
						   </view>
						  <view class="eye" v-show='!seen' @click="changeSeen">
						    <image src="../../static/tabs/eye.png" />
						  </view> 
			<view style="margin: 16px;">
				<view class="tijiao" @click="submit" style="width: 300rpx;height: 80rpx;line-height: 80rpx;color: #fff;font-size: 24rpx;background-color: #007AFF;text-align: center;border-radius: 40rpx;margin: 0 auto;">
					<text>提交</text>
				</view>
			</view>
		</van-form>

		
		
		
		
		

	</view>
</template>

<script>
	import {
		passwordedit,
		findAllList
	} from "@/api/customer/passwordcode";
	import {
		Toast
	} from 'vant';
	export default {
		data() {
			return {
				  usr_pwd: "",
				                seen: false,
				                type_text: "text",
				                type_password: "password",
				uuu: 'display:none',
				value: '',
				password: "",
				listindex: [],
				showKeyboard: true,
				form: {
					passwordnum: '',
					numcustomerId: '',
				}
			}
		},
		methods: {
			changeSeen(){
			                this.seen = !this.seen;
			            },

			getList() {
				findAllList().then(res => {
					this.listindex = res.data;
					this.form.numcustomerId = res.data[0].customerId;
					this.password = res.data[0].passwordcode;
					console.log('**********' + this.form.numcustomerId);
				})
			},

			submit() {
				if (this.password == 0) {
					Toast.fail('不能为空')
					return false;
				}
				this.form.passwordnum = this.password;
				passwordedit(this.form).then(res => {

					this.uuu = 'display:none';
					Toast.success('密码修改成功')
					return 0;
				})
			},

			toBack() {
				this.$router.go(-1);
			},

		},
		created() {
			this.getList();
		}
	}
</script>

<style>
	.eye image{
		width: 50rpx;
		height: 50rpx;
		margin-top: -100rpx;
		margin-right: 50rpx;
		float: right;
	}
.demo-nav{
    position: relative;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: center;
    justify-content: center;
    height: 56px;
    background-color: #fff;
    font-size: 1.1rem;
  }
  .demo-nav__back{
    position: absolute;
    top: 16px;
    left: 16px;
    width: 24px;
    height: 24px;
    cursor: pointer;
  }
</style>
